package com.carambatv.android.ui;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.FragmentActivity;

import com.carambatv.android.R;
import com.carambatv.android.ui.sliding.ResultActivity;
import com.carambatv.android.utils.ToastUtil;

public class SplashActivity extends FragmentActivity {
	private static final long SPLASH_DISPLAY_LENGTH = 1500;
	private CarambaApp app;

	// private VideoView vd;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.splash);

		app = (CarambaApp) getApplicationContext();
		if (!app.isInternetPresent())
			ToastUtil.showNoNetwork(getApplicationContext());

		new Handler().postDelayed(new Runnable() {
			@Override
			public void run() {

				final Intent mainIntent = new Intent(SplashActivity.this, ResultActivity.class);
				startActivity(mainIntent);
				finish();
			}
		}, SPLASH_DISPLAY_LENGTH);

		// showVideo();

	}

	// @Override
	// protected void onPause() {
	// Log.v("MediaVideo", "onPause");
	// super.onPause();
	// this.vd.pause();
	// }
	//
	// @Override
	// protected void onDestroy() {
	// super.onDestroy();
	// }
	//
	// @Override
	// protected void onResume() {
	// super.onResume();
	// this.vd.resume();
	// }
	//
	// private void showVideo() {
	// vd = (VideoView) findViewById(R.id.videoview);
	// Uri uri = Uri.parse("android.resource://" + getPackageName() + "/" +
	// R.raw.test1);
	// vd.setMediaController(null);
	// vd.setOnCompletionListener(completionListener);
	// vd.setVideoURI(uri);
	// vd.requestFocus();
	// vd.start();
	// }
	//
	// final OnCompletionListener completionListener = new
	// OnCompletionListener() {
	//
	// @Override
	// public void onCompletion(MediaPlayer mp) {
	// final Intent mainIntent = new Intent(SplashActivity.this,
	// ResultActivity.class);
	// startActivity(mainIntent);
	// finish();
	// }
	// };

}
